# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=cl-fiveam
_pkgname="${pkgname#cl-}"
pkgver=1.4.2.r12.ge11dee7
pkgrel=2
pkgdesc='A regression testing framework for Common Lisp'
arch=('any')
url='https://fiveam.common-lisp.dev'
license=('MIT')
depends=(
  'cl-asdf'
  'common-lisp'
  'cl-alexandria'
  'cl-asdf-flv'
  'cl-trivial-backtrace'
)
makedepends=('git')
checkdepends=('sbcl')
_commit='e11dee752a8f59065033ef9d60641d4a2f1e8379'
source=(
  "$pkgname::git+https://github.com/lispci/fiveam#commit=$_commit"
  'run-tests.lisp'
)
b2sums=('SKIP'
        '40143c74430fb552a0cf7e9c309da2e25f0ed969c28b67206b4c60e2fd73d32cafc3e53e16fcde16326b9376aca7d5bc9cb5f472de2576c9d3958af7a93dd4f9')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed -e 's/^v//' -e 's/-/.r/' -e 's/-/./g'
}

check() {
  cd "$pkgname"

  sbcl --script ../run-tests.lisp
}

package() {
  cd "$pkgname"

  # library
  install -vd "$pkgdir/usr/share/common-lisp/source/$_pkgname"
  cp -vr \
    src t \
    fiveam.asd version.sexp \
    "$pkgdir/usr/share/common-lisp/source/$_pkgname"

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" COPYING
}
